home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 1303 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.2 KB

  1. Path: hubcap.clemson.edu!hubcap!mjs
  2. From: mjs@hubcap.clemson.edu (M. J. Saltzman)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: void pointers
  5. Date: 12 Jan 96 22:52:07 GMT
  6. Organization: Clemson University
  7. Message-ID: <mjs.821487127@hubcap>
  8. References: <1996Jan12.133322.1@ccc.govt.nz> <4d6h8k$p6u@axe.netdoor.com>
  9. NNTP-Posting-Host: hubcap.clemson.edu
  10.  
  11. esargent@netdoor.com (Eric Sargent) writes:
  12.  
  13. >mcauslanb@ccc.govt.nz wrote:
  14.  
  15. >>I am writing a C program for an application that has a development language 
  16. >>based on ANSI C.
  17.  
  18. >>A function that I need to call is defined:
  19. >>    void getFence (void **clipPP);
  20.  
  21. >>   where "clipPP" is returned by the function.
  22.  
  23. >>1) How do I declare and pass clipPP?
  24.  
  25. >void (char, etc..)    *clipPP;
  26.  
  27. >getFence(&clipPP);        (may need to be cast if not a void pointer)
  28.  
  29. Casting a pointer to non-void pointer to some other type here is an error!
  30.  
  31. Since the code in the body of getFence() assumes that it will deposit
  32. a void pointer, if you pass the address of another type of pointer
  33. (perhaps with a different size), getFence will write a value in the
  34. wrong format for that type of pointer.
  35. -- 
  36.         Matthew Saltzman
  37.         Clemson University Math Sciences
  38.         mjs@clemson.edu
  39.